export const calcSize = (value?: string | number, containerWidth?: number) => {
	if (!value) return 0;
	if (typeof value === "string") {
		if (value.includes("rpx")) {
			return containerWidth ? fromRpxToPx(containerWidth, Number(value.replaceAll("rpx", ""))) + "px" : "0px";
		}
		return value;
	}
	if (typeof value === "number") return value + "px";
};
export const getMobileSize: (value: string | number) => string = (value: string | number) => {
	if (typeof value === "string") {
		if (value.includes("rpx")) {
			return value;
		} else {
			return Math.floor(Number(value.replaceAll("px", "")) * 0.65) + "px";
		}
	}
	if (typeof value === "number") {
		return Math.floor(value * 0.65) + "px";
	}
	return "0px";
};
export const fromRpxToPx = (containerWidth: number, rpx: number) => {
	const percent = rpx / 750;
	return percent * containerWidth;
};
